package cn.dm.server.mail;


import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//@Service
public class MailServiceImpl implements MailService {

    //创建邮箱信息接口类对象
    @Resource
    private SimpleMailMessage mailMessage;

    //创建邮箱发送接口类对象
    @Resource
    private MailSender mailSender;


    /**
     * 发送激活邮箱
     *
     * @param mailTo
     * @param activationCode
     * @throws Exception
     */
    @Override
    public void sendActivationMail(String mailTo, String activationCode) throws Exception {
        mailMessage.setTo(mailTo);
        mailMessage.setText("你的验证码：" + activationCode);
        mailSender.send(mailMessage);
    }
}
